package com.mgs.product.tagger.handlers
{
	import com.mgs.fwk.context.ApplicationContext;
	import com.mgs.fwk.handlers.ActionHandler;
	import com.mgs.product.tagger.controller.ContextController;
	import com.mgs.product.tagger.actions.ApplicationAction;
	import com.mgs.product.tagger.ui.dto.ClassifiableUI;
	import com.mgs.product.tagger.ui.dto.NavigationContext;
	
	import mx.collections.ArrayList;
	
	public class ReleaseAllElementsHandler implements ActionHandler
	{
		public function execute(context:ApplicationContext, action:ApplicationAction):void
		{
			for each(var element:ClassifiableUI in (context as NavigationContext).lockedElements.toArray())
			{
				ContextController.retagElement((context as NavigationContext), element);
				element.locked = false;
			}
			(context as NavigationContext).lockedElements = new ArrayList();
			// TODO optim : seuelement si des axes ont été retagués.
			ContextController.updateContext(context as NavigationContext);
		}
	}
}